//
//  UIButton+ZHMakeButton.m
//  ZYT_IOS
//
//  Created by 正合适 on 2018/1/29.
//  Copyright © 2018年 正合适. All rights reserved.
//

#import "UIButton+ZHMakeButton.h"

@implementation UIButton (ZHMakeButton)
+ (instancetype)ZHMakeButtonWithFrame:(CGRect)frame bgColor:(UIColor *)bgColor title:(NSString *)title img:(UIImage *)img {
    return [UIButton ZHMakeButtonWithFrame:frame bgColor:bgColor title:title img:img font:nil textColor:nil];
}

+ (instancetype)ZHMakeButtonWithFrame:(CGRect)frame bgColor:(UIColor *)bgColor title:(NSString *)title img:(UIImage *)img font:(UIFont *)font textColor:(UIColor *)textColor {
    UIButton *btn = [[UIButton alloc] initWithFrame:frame];
    btn.backgroundColor = bgColor;
    if (title.length > 0) [btn setTitle:title forState:UIControlStateNormal];
    if (img) [btn setImage:img forState:UIControlStateNormal];
    if (font) btn.titleLabel.font = font;
    if (textColor) [btn setTitleColor:textColor forState:UIControlStateNormal];
    return btn;
}
@end
